'''新建个人信息'''

# 随机生成姓名
import random
from identity import IdNumber
# from xpinyin import Pinyin

def personal_name():
    first_names = ['赵','钱','孙','李','周','吴','郑','王','冯','陈','褚','卫','蒋','沈','韩','杨','朱','秦','尤','许','何','吕','施','张','孔','曹','严','华','金','魏','陶','姜','戚','谢','邹','喻','柏','窦','章','云','苏','潘','葛','奚',
                   '全','郗','班','仰','秋','仲','伊','宫','景','詹','束','龙','牧','隗','山','谷','祁','毛','禹','狄','计','伏','成','戴','顾','孟','平','黄','闻','莘','翟','谭','贡','劳','逄','姬','申','扶','堵','冉','宰','郦','雍']
    last_names = ['夏瑶','念文','晓丝','涵蕾','冰夏','亦','竹','飞','莲','海','白','听安','芷雪','以松','梦槐','易梦','惜雪','宛海','之柔','元芹','若云','寒烟','听筠','念云','晓灵','静枫','夏蓉','曼雁','雁露','凝冬','含灵','夏青', '亦瑶',
                  '妙菡','紫蓝','安珊','夏之','易槐','宛亦','山彤','尔柳','沛柔','灵萱','凡桃','新儿','夏波','雨琴','映梦','安雁','映容','凝阳','夜天','安筠','觅柔','初南','百成','理菡','宇琼','朝健','云新','萱妍','元生','雨霏','成锦','语汐',
                  '东锋','若颖','明轩','冰欣','秋胜','紫绮','依嘉']
    random_first_name = random.choice(first_names)
    random_last_name = random.choice(last_names)
    name = random_first_name  + random_last_name
    return name

# 随机生成电话号码
def generate_phone_number():
    last_bits = '0123456789'
    list_last_bits = []
    phone_prefix = ["130", "131", "132", "133", "134", "135", "136", "137", "138", "139",
                    "150", "151", "152", "153", "155", "156", "157", "158", "159",
                    "180", "181", "182", "183", "184", "185", "186", "187", "188", "189"]
    prefix = random.choice(phone_prefix)
    for i in range(8):
        list_last_bits.append(random.choice(last_bits))
    suffix = ''.join(list_last_bits)
    return prefix + suffix
# 生成电话号码
phone_number = generate_phone_number()

name = personal_name()
random_sex = random.randint(0, 1)  # 随机生成男(1)或女(0)
id_card = IdNumber.generate_id(random_sex)  # 随机生成身份证号

# 根据姓名读取拼音
# def chinese_to_pinyin():
#     p = Pinyin()
#     surname = name[0]
#     surname_pinyin = p.get_pinyin(surname)
#     return surname_pinyin

personal_information_dict = {
    'name':name,
    # 'surname':chinese_to_pinyin(),
    'phone':generate_phone_number(),
    'id_card':id_card
}


print(personal_information_dict)
